package org.jeecg.common.constant.enums;

import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.RoleConstant;

/**
 * 角色码枚举
 *
 * @author qiang.zhou
 * @createtime 2023-03-07  16:50
 */
public enum RoleCode implements BaseEnum<String, String> {
    SYS_ADMIN(RoleConstant.SYS_ADMIN, "系统管理员"),
    SUPPER_ADMIN(RoleConstant.SUPPER_ADMIN, "超级管理员"),
    USER(RoleConstant.USER, "普通用户")
    ;

    private String code;

    private String name;

    RoleCode(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public boolean checkCode(String code) {
        return !StringUtils.isBlank(code) && this.code.equals(code);
    }
}
